from app.models import db
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class ToUsers(Base):
    __tablename__ = 'to_userinfo'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(255))
    password = db.Column(db.String(255))
    name = db.Column(db.String(255))
    qq = db.Column(db.String(11))
    isadmin = db.Column(db.Integer)
    status = db.Column(db.Integer)
    level = db.Column(db.Integer)
    regip = db.Column(db.String(255))
    regtime = db.Column(db.String(255))
    regcity = db.Column(db.String(255))
    loginip = db.Column(db.String(255))
    logintime = db.Column(db.Integer)
    logincity = db.Column(db.String(255))
    token = db.Column(db.String(255))
    token_end = db.Column(db.Integer)


class ToTask(Base):
    __tablename__ = 'to_taskinfo'
    id = db.Column(db.Integer, primary_key=True)
    uuid = db.Column(db.String(255))
    title = db.Column(db.String(255))
    explain = db.Column(db.String)
    people = db.Column(db.String)
    level = db.Column(db.Integer)
    status = db.Column(db.Integer)
    starttime = db.Column(db.Integer)
    endtime = db.Column(db.Integer)
    found = db.Column(db.String(255))
    source = db.Column(db.String(255))
    onlineword = db.Column(db.String)
    addtime = db.Column(db.String)


class ToMessage(Base):
    __tablename__ = 'to_message'
    id = db.Column(db.Integer, primary_key=True)
    uuid = db.Column(db.String(255))
    type = db.Column(db.String(255))
    m_from = db.Column(db.String(255))
    m_goto = db.Column(db.String(255))
    message = db.Column(db.String(255))
    isread = db.Column(db.Integer)
    send_time = db.Column(db.Integer)
    die_time = db.Column(db.Integer)
